﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Sukul.PhotoTools.BL.Configuration;

namespace Sukul.PhotoTools.UI
{
    public partial class Options : Form
    {
        public Options()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Options_Load(object sender, EventArgs e)
        {
            var section = (Sukul.PhotoTools.BL.Configuration.MediaConfigSection)ConfigurationManager.GetSection("MediaSettingsGroup/MediaSettings");
            txtPhotoFilter.Text = section.Photo.Filter;
            txtVideoFilter.Text = section.Video.Filter;
        }

        private void Options_FormClosing(object sender, FormClosingEventArgs e)
        {
            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var section = (Sukul.PhotoTools.BL.Configuration.MediaConfigSection)config.GetSection("MediaSettingsGroup/MediaSettings");
            section.Photo.Filter = txtPhotoFilter.Text;
            section.Video.Filter = txtVideoFilter.Text;
            int count = 0;
            
            config.Save(ConfigurationSaveMode.Modified);

        }
    }
}
